package com.greensam.pixelengine.event.pixel;

import com.greensam.pixelengine.event.base.AbstractTypeEvent;
import com.greensam.pixelengine.event.base.WrappedEventParams;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Map;

/**
 * PixelEvent 消息总线
 * @author Ma Chengrui
 * @since 2025/10/13 17:38
 */
@Getter
@Setter
@NoArgsConstructor
public class PixelEvent extends AbstractTypeEvent<PixelEvent> {

    private PixelEventType eventType;

    public PixelEvent(Map<String, Object> data, PixelEventType eventType) {
        super(data);
        this.eventType = eventType;
    }

    public <T extends WrappedEventParams> PixelEvent(PixelEventType eventType, T wrappedEvent) {
        super();
        this.eventType = eventType;
        this.setWrappedEvent(wrappedEvent);
    }

    @Override
    public PixelEvent copy() {
        return new PixelEvent(data, eventType);
    }

    @Override
    public String getEventTypeCode() {
        return eventType.getCode();
    }
}
